//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_DataStation_H
#define Green_DataStation_H

#include <map>

#include "Defines.h"
#include "Object.h"

namespace Green {

  /*!
    \class DataStation
    \brief data station
   */

  class DataStation {
  public:
    static void Initialize();  //!< Initialization interface.
    static void Destroy();     //!< Destruction clean up interface.
    inline static DataStation* Instance() { return mspDataStation; } //!< Access data station instance.

    Object* Get(uint64 id);  //!< Get object with given record id
    uint64 Add(Object* obj);   //!< Add the given object to the list and return the assigned record id
    void Remove(uint64 id);  //!< Remove object with given record id

  private:
    DataStation();  //!< Constructor, private
    ~DataStation(); //!< Destructor, private
  private:
    static DataStation* mspDataStation;  //!< Static singleton pointer to data station
    std::map<uint64, Object*> mObjects;  //!< a list of objects
    uint64 mCurId;  //!< point to next available id
  };

}

#endif
